package com.jiangnan.api.service

import com.jiangnan.entity.Book
import com.jiangnan.entity.Res
import retrofit2.http.GET
import retrofit2.http.PUT
import retrofit2.http.Query

interface InteractionApiService {
    @PUT("interaction/favorite")
    suspend fun markFavorite(
        @Query("userId") userId: Int,
        @Query("bookId") bookId: Int
    ): Res<Any>


    @PUT("interaction/rating")
    suspend fun updateRating(
        @Query("userId") userId: Int,
        @Query("bookId") bookId: Int,
        @Query("rating") rating: Double
    ): Res<Any>

    @PUT("interaction/borrow")
    suspend fun borrowBook(
        @Query("userId") userId: Int,
        @Query("bookId") bookId: Int
    ): Res<Any>

    @GET("collection")
    suspend fun getFavoriteBooks(
        @Query("userId") userId: Int
    ): Res<List<Book>>

    @PUT("interaction/cancleFavorite")
    suspend fun cancelFavorite(
        @Query("userId") userId: Int,
        @Query("bookId") bookId: Int
    ): Res<Any>


}